/**
 * 全屏提示消息 代替alert
 *@param str 提示的消息 若消息未空不显示
 *@param time 显示时间
 *@param color 文字颜色
 *
 */

//调用方法
// 	$.tipNotice({
// 		str:"提示消息",
// 		time:3,
// 		color:"red",
// 	});
$.extend({
	tipNotice:function(options){
		options = $.extend({
			str:'',
			time:3,
			color:"black",
		},options);
		if(options.str){ //消息存在则显示
			$(".mytips").remove();
			$("body").append("<span class='mytips'>"+options.str+"</span>");
			var tip = $(".mytips");
			tip.css({
				"display":"inline-block",
				"min-width":"120px",
				"text-align":"center",
				"height":"35px",
				"line-height":"35px",
				"background":"rgba(79,79,79,0.3)",
				"padding":"0 8px",
				"border-radius":"5px",
				"position":"fixed",
				"color":options.color,
			});
			var w_width = $(window).width();
			var w_height = $(window).height();
			var t_width = tip.outerWidth();
			var t_height = tip.outerHeight();
			tip.css({
				"left":(w_width-t_width)/2+"px",
				"top":(w_height-t_height)/2+"px",
			});
			setTimeout(function(){
				tip.fadeOut(1000);
				tip.remove();
			},options.time*1000);
		}
	}
});